/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package UTILS;

import BUS.ChiTietPhieuXuatBUS;
import BUS.DaiLyBUS;
import BUS.DonViBUS;
import BUS.LoaiDaiLyBUS;
import BUS.MatHangBUS;
import BUS.PhieuThuBUS;
import BUS.PhieuXuatHangBUS;
import BUS.QuanBUS;
import BUS.TinhBUS;
import DTO.ChiTietPhieuXuatDTO;
import DTO.DaiLyDTO;
import DTO.DonViDTO;
import DTO.LoaiDaiLyDTO;
import DTO.MatHangDTO;
import DTO.PhieuThuDTO;
import DTO.PhieuXuatHangDTO;
import DTO.QuanDTO;
import DTO.TinhDTO;
import javax.swing.JPanel;
import javax.swing.table.TableModel;

/**
 *
 * @author HuuTri
 */
public class TableGUIFactory {
    public static TableGUI createTable(String tableName) {
        return new TableGUI(getTableModel(tableName));
    }
    
    /**
     * get table model by table name
     * @param tableName  
     * @return 
     */
    public static TableModel getTableModel(String tableName) {
        switch (tableName) {
            case QuanDTO.TABLE_NAME: return QuanBUS.getTableModel();
            case DaiLyDTO.TABLE: return DaiLyBUS.getTableModel();
            case TinhDTO.TABLE: return TinhBUS.getTableModel();
            case MatHangDTO.TABLE: return MatHangBUS.getTableModel();
            case DonViDTO.TABLE: return DonViBUS.getTableModel();
            case LoaiDaiLyDTO.TABLE: return LoaiDaiLyBUS.getTableModel();
            case PhieuThuDTO.TABLE: return PhieuThuBUS.getTableModel();
            case PhieuXuatHangDTO.TABLE: return PhieuXuatHangBUS.getTableModel();
            case ChiTietPhieuXuatDTO.TABLE: return ChiTietPhieuXuatBUS.getTableModel();
            default: return null;
        }
    }
}
